from django.db import models
from fuguang.utils.models import BaseModel


# 模型类
class NavModel(BaseModel):
    POSITION_CHOICES = {
        (0, '顶部导航'),
        (1, '底部导航'),
    }
    link = models.CharField(max_length=255, verbose_name='导航菜单')
    is_http = models.BooleanField(default=False, verbose_name='是否是外部链接')
    # 导航位置（头部底部导航）
    position = models.IntegerField(choices=POSITION_CHOICES, default=0)

    class Meta:
        db_table = 'fg_nav'
        # verbose_name = '导航菜单'
        verbose_name_plural = '导航菜单'


# 轮播图模型类
class BannerModel(BaseModel):

    image = models.ImageField(upload_to='banner/%Y/')
    link = models.CharField(max_length=255, verbose_name='外部连接')
    note = models.CharField(max_length=200, verbose_name='备注信息')
    is_http = models.BooleanField(default=False, verbose_name='是否是外部连接', help_text='站点外部连接：http://www.baidu.com <br> 站点内连接：/home/banner')

    class Meta:
        db_table = 'lf_banner'
        verbose_name_plural = '轮播广告图'
